package misc;

import java.util.Calendar;
/*
 * Copyright (C) 2014 Kim Lindgren
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.GregorianCalendar;

public class Time {
    public static String getTime(){
        GregorianCalendar gCal = new GregorianCalendar();
        int hour = gCal.get(Calendar.HOUR_OF_DAY);
        int minute = gCal.get(Calendar.MINUTE);
        int second = gCal.get(Calendar.SECOND);
		
        String sHour;
        String sMinute;
        String sSecond;
        String time;
		
        if(hour < 10)
            sHour = "0" + hour;
        else
            sHour = Integer.toString(hour);
        
        if(minute < 10)
            sMinute = "0" + minute;
        else
            sMinute = Integer.toString(minute);
        
        if(second < 10)
            sSecond = "0" + second;
        else
            sSecond = Integer.toString(second);
            
        time = "[" + sHour + ":" + sMinute + ":" + sSecond + "]";
		
        return time;
    }
}
